﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    public enum TestType
    {
        Z,Y,R,X,G,B,LS,LP,CS,CP,RS,RP,Q,D,TZ,TY,VAC,IAC,VDC,IMP,ADM
    }
    public enum Lunit
    {
        H,uH,nH,F,uF,nF,pF,ohm
    }
    public enum FreqUnit
    {
        Hz,KHz,MHz
    }
    public class TestItem
    {
        public TestItem()
        {
            Enable = false;
            Name= string.Empty;
            Description= string.Empty;

        }

        public bool Enable { get; set; }
        
        public string Name { get; set; }
        public string Description { get; set; }
        public TestType tType { get; set; }

        public int Points { get; set; }

        public uint Marker { get; set; }
        public uint StartFrequency { get; set; }

        public uint EndFrequency { get; set; }
        public FreqUnit FrequencyUnit { get; set; }

        public uint OSCLevel { get; set; }

        public double UpperLimit { get; set; }
        public double LowerLimit { get; set; }
        public Lunit LimitUnit { get; set; }

        public string GuidePicturePath { get; set; }


        public string TestType1CMD()
        {
            StringBuilder stringBuilder = new StringBuilder(":CALC1:PAR1:DEF ");
            switch (this.tType)
            {
                case TestType.LS: stringBuilder.Append("LS"); break;
                case TestType.LP: stringBuilder.Append("LP"); break;
                case TestType.CS:stringBuilder.Append("CS");break;
                case TestType.CP: stringBuilder.Append("CP");break;
                //case TestType.Z:stringBuilder.Append("Z");break;
                //case TestType.Y:stringBuilder.Append("Y");break;
                //case TestType.G: stringBuilder.Append("G");break;
                
                default: stringBuilder.Append("Z"); break;
            }

            return stringBuilder.ToString();
        }

        public string TestType2CMD()
        {
            StringBuilder stringBuilder = new StringBuilder(":CALC1:PAR2:DEF ");
            switch (this.tType)
            {
                case TestType.LS: stringBuilder.Append("Q"); break;
                case TestType.LP: stringBuilder.Append("Q"); break;
                case TestType.CS: stringBuilder.Append("Q"); break;
                case TestType.CP: stringBuilder.Append("Q"); break;
                case TestType.Z:stringBuilder.Append("TZ"); break;
                    default: stringBuilder.Append("TZ"); break;
            }

            return stringBuilder.ToString();
        }

    }
    
}
